home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-03 | 1.8 KB | 31 lines | [TEXT/R*ch] |
- import marshal
-
-
- # Write a file containing frozen code for the modules in the dictionary.
-
- header = """
- struct frozen {
- char *name;
- unsigned char *code;
- int size;
- } frozen_modules[] = {
- """
- trailer = """\
- {0, 0, 0} /* sentinel */
- };
- """
-
- def makefreeze(outfp, dict):
- done = []
- mods = dict.keys()
- mods.sort()
- for mod in mods:
- modfn = dict[mod]
- try:
- str = makecode(modfn)
- except IOError, msg:
- sys.stderr.write("%s: %s\n" % (modfn, str(msg)))
- continue
- if str:
- done.append(mod, len(str))